#ifndef GRAPHICS_ENGINE_H
#define GRAPHICS_ENGINE_H

//Project includes
#include "Window.h"
#include "Drawable.h"
#include "Camera.h"
#include "Light.h"

//OpenGL Utility Library
#include "GLUT.h"

namespace Graphics
{
	class Engine
	{
		public:
				/** Returns an instance of the Graphics Engine */
				static Engine* instance();

				/** Inits the engine (supports command line arguments) */
				static void initialize(int argc, char* argv[]);
				/** Create a new Graphics Window */
				void createWindow(Size size, std::string title, bool fullscreen=false);

				/** Runs the engine */
				void start();

				/** Returns the scene */
				Renderable* scene();

				/** Shuts down the Graphics Rendering Engine */
				void shutdown();

				/** Returns the graphics window */
				Window* window();

				/** Are helpers enabled? */
				bool helpers();

				/**********
				* SETTERS *
				**********/

				/** Sets the current scene */
				void setScene(Renderable* s);

				/** Enable/Disable helpers */
				void setHelpers(bool h);

		protected:
				Engine();
				~Engine();

		private:
				//The graphics window
				Window* _window;
				bool _helpers;

				unsigned long _fps;
				Light _light;
				Light _light2;

				/** A container for all renderable objects */
				Renderable* _scene;

				Camera _camera;

				/** GLUT reshape callback */
				static void _reshape(int w, int h);
				/** GLUT display callback */
				static void _display();
				/** GLUT keyboard callback */
				static void _keyboard(unsigned char key, int x, int y);
				static void _special(int key, int x, int y);
				/** GLUT mouse callback */
				static void _mouse(int button, int state, int x, int y);
				/** GLUT mouse callback */
				static void _wheel(int button, int dir, int x, int y);
				/** GLUT idle callback */
				static void _idle();
	};
}

#endif
